import java.util.Scanner;
public class ReturnArrayReference {
        
    private static double[] readArray(){
    	Scanner scanner = new Scanner(System.in);
    	System.out.printf("Enter number of elements: ");
    	int size = scanner.nextInt();
    	double[] x = new double[size];
    	for(int index = 0; index < size; index++){
    		System.out.printf("Enter element x[%d]: ", index);
    		x[index] = scanner.nextDouble();
    	}
    	return x;
    }
    
    private static void printArray(double[] array){
    	for(int k = 0; k < array.length; k++)
    		System.out.printf("%.1f  ", array[k]);
    }
    
    public static void main(String[] args) {
        double[] values;
        values = readArray();
        System.out.printf("%nThe array is:%n");
        printArray(values);
    }
}
